package com.leyou.config;

import com.leyou.auth.utils.UserContext;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;

/**
 * @author jshstart
 * @creat 2020-12-26 17:49
 */

/**
 * 拦截feign的请求，添加请求头
 */
@Component
public class JwtInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate requestTemplate) {
        requestTemplate.header("Cookie", "LY_USER_TOKEN=" + UserContext.getJwt());
    }
}
